package com.android.butterknife;

import butterknife.Bind;
import butterknife.ButterKnife;
import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class ImgPageAdapter extends PagerAdapter {
	private LayoutInflater mInflater;

	public ImgPageAdapter(Context context) {
		mInflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return 3;
	}

	@Override
	public boolean isViewFromObject(View view, Object obj) {
		return view == obj;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView((View) object);
	}

	@Override
	public View instantiateItem(ViewGroup container, int position) {
		View convertView = mInflater.inflate(R.layout.item_page_view, null);
		ViewHolder holder = new ViewHolder(convertView);
		holder.img.setImageResource(R.drawable.pic);
		container.addView(convertView);
		return convertView;
	}

	class ViewHolder {
		@Bind(R.id.img)
		ImageView img;

		public ViewHolder(View view) {
			ButterKnife.bind(this, view);
		}

	}

}
